Skip to content

Conversation

@RinZ27
Copy link
Contributor

@RinZ27 RinZ27 commented Jan 8, 2026

Several samples currently use .innerHTML for DOM manipulation where textContent or replaceChildren() is more appropriate.

Updated the following to follow XSS prevention best practices:

  1. api-samples/printing/printers.js: Replaced .innerHTML = label with .textContent = label in the createButton utility to mitigate potential script injection.
  2. api-samples/tabs/inspector/window_and_tabs_manager.js: Switched to .replaceChildren() for more secure and performant DOM clearing.

These changes ensure the samples align with modern security standards for Chrome Extensions.

Copy link
Member

@oliverdunk oliverdunk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@oliverdunk oliverdunk merged commit 5e666b9 into GoogleChrome:main Jan 8, 2026
2 checks passed
@RinZ27 RinZ27 deleted the security/cleanup-xss-sinks branch January 9, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants